<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      overflow-x: hidden;
      padding: 30px 0;
      gap: 20px;
    }

    .box {
      width: 300px;
      height: 200px;
      background-color: aquamarine;
      border-radius: 10px;
      line-height: 200px;
      text-align: center;
      font-size: 20px;
      font-weight: 700;
      transform: translateX(-400%);
      transition: all 0.3s ease;
    }

    .box:nth-of-type(even) {
      transform: translateX(400%);
    }

    .box.show {
      transform: translateX(0);
    }

  </style>
</head>
<body>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
  <div class="box">content</div>
</body>

<script>
  const boxs = document.querySelectorAll('.box')
  const update = () => {
    const windowTop = window.innerHeight / 5 *3

    boxs.forEach((box) => {
      const boxTop = box.getBoundingClientRect().top
      if(windowTop > boxTop) {
        box.classList.add('show')
      } else {
        box.classList.remove('show')
      }
    })
  }
  update()
  window.addEventListener('scroll', update)
</script>
</html>